﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Resources;
using System.Reflection;
using System.Xml.Serialization;
using System.IO;

namespace Mimoza.CitrixPlugin
{
    class ConfigPlugin : Mimoza.PluginLayer.IConfigPlugin
    {
        public ConfigPlugin()
        {

        }

        #region IConfigPlugin Members

        public string Identity
        {
            get { return Resource.PluginIdentity; }
        }

        public string Name
        {
            get { return Resource.PluginName; }
        }

        public string Description
        {
            get { return Resource.PluginDescription; }
        }

        public bool IsHardware
        {
            get { return false; }
        }

        public System.Drawing.Icon Icon
        {
            get { return Resource.PluginIcon; }
        }

        public bool IsMultiple
        {
            get { return true; }
        }

        public string Serialize(object userData)
        {
            CitrixData pluginData = userData as CitrixData;
            if (pluginData == null)
            {
                Common.Logger.Log.Error(
                    "Mimoza.RdpPlugin.ConfigPlugin error: userData is not correct");
                return null;
            }

            return pluginData.Serialize();
        }

        public object Deserialize(string stringFrom)
        {
            if (stringFrom != null)
            {
                return CitrixData.Deserialize(stringFrom);
            }
            return new CitrixData();
        }

        public IEnumerable<Mimoza.GUI.IWizardPage> Pages
        {
            get 
            {
                yield return new GeneralPage();
                yield return new DisplayPage();
                yield return new LocalResourcesPage();
                yield return new ProgramsPage();
            }
        }

        public IEnumerable<Mimoza.GUI.IWizardPage> WizardPages
        {
            get 
            {
                yield return new GeneralPage();
                yield return new DisplayPage();
            }
        }

        #endregion
    }
}
